package com.paw.oauth2.web.marshall.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author lvzihai
 * @date 2021/7/15
 **/
@Slf4j
@Controller
public class MarshallController {

  @GetMapping({"/","index"})
  public String index(){
    return "index";
  }


  @GetMapping("/hello")
  public String hello(){
    Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    Object details = SecurityContextHolder.getContext().getAuthentication().getDetails();
    log.info("principal {}",principal.toString());
    log.info("detail {}",details.toString());

    return "hello";
  }

}
